	
		
*******************************************************
* (1.0) Load the analysis sample - mother-year panel
*******************************************************

	use 	"$f_2PKmotherpanel", clear	
	gen svydate		= (88*12)+7
		
	cap drop _merge
	merge m:1 prov year using `"$d_data\ProductionData.dta"'
	
	cap drop _merge
	merge m:1 prov year using `"$d_data\IMR.dta"'

	drop if year<year_marriage		
	drop if years_since_LLF < -9 | years_since_LLF > 8
	drop if year >=1980
	drop if year <1964
	
	forval i = 1/9 {
		gen 	years_since_LLFpre`i' 	= 0 if years_since_LLF != . 
		replace years_since_LLFpre`i' 	= 1 if years_since_LLF == -`i'
 	}

		gen 	years_since_LLFpost0 	= 0 if years_since_LLF != . 
		replace years_since_LLFpost0 	= 1 if years_since_LLF == 0 	

	forval i = 1/9 {
		gen 	years_since_LLFpost`i' 	= 0 if years_since_LLF != . 
		replace years_since_LLFpost`i' 	= 1 if years_since_LLF == `i'
 	}
	
	gen son = hasson 
	gen noson = 1 if hasson == 0 
	replace noson = 0 if hasson == 1
	
		forval j = 1/9 { 
			gen noson_pre_`j' = years_since_LLFpre`j' *noson
			} 
		forval j = 0/9 { 
			gen noson_p_post_`j' = years_since_LLFpost`j'*noson 
			}
	
	*group 4th births and higher (parity 3 moms) 
	replace parity = 3 if parity >=3 & parity != . 
	
	forval i = 1/3 { 
		gen p_`i' = 0 if parity != . 
		replace p_`i' = 1 if parity == `i'
		gen year_p`i'= year*p_`i'
		} 
		
	* make interactions parity x years since LLF leaving out parity 0 moms
	forval i = 1/3 { 
		
		forval j = 1/9 { 
			gen p`i'_LLFpre`j' = 0 if years_since_LLF != . & parity != . 
			replace p`i'_LLFpre`j' = 1 if years_since_LLF == -`j' & parity == `i' 
			} 
			
			gen p`i'_LLFpost0 = 0 if years_since_LLF != . & parity != . 
			replace p`i'_LLFpost0 = 1 if years_since_LLF == 0 & parity == `i' 
			
		forval j = 1/9 { 
			gen p`i'_LLFpost`j' = 0 if years_since_LLF != . & parity != . 
			replace p`i'_LLFpost`j' = 1 if years_since_LLF == `j' & parity == `i' 
			} 
		}	
		
	* make interactions parity x years since LLF x sons leaving out parity 0 moms
	forval i = 1/3 { 
		
		forval j = 1/9 { 
			gen p`i'_LLFpre`j'_son =  p`i'_LLFpre`j'*hasson 
			} 
			
			gen p`i'_LLFpost0_son = p`i'_LLFpost0*hasson 
			
		forval j = 1/9 { 
			gen p`i'_LLFpost`j'_son =  p`i'_LLFpost`j'*hasson
			} 
		}
	
	forval j = 1/9 { 
		gen pre_`j'_son = years_since_LLFpre`j' *hasson
		} 
	forval j = 0/9 { 
		gen post_`j'_son = years_since_LLFpost`j'*hasson 
		}
			
	gen p1_son = p_1*hasson
	gen p2_son = p_2*hasson
	gen p3_son = p_3*hasson
	
	cap drop _merge
	merge m:1 prov using `"$d_data\sentdown_mean.dta"'
	drop _merge 
	
	gen 	culturalrev = 0 
	replace culturalrev = mean_sentdown if year >= 1966 & year <=1969

*****************************************************
* (2.0) Gen Stacked Data 
*****************************************************

	do `"$d_do\LLF_StackData.do"'

	gen years_since_LLF = year - LLFyear 
	forval i = 1/9 {
		gen 	years_since_LLFpre`i' 	= 0 if years_since_LLF != . 
		replace years_since_LLFpre`i' 	= 1 if years_since_LLF == -`i'
 	}

		gen 	years_since_LLFpost0 	= 0 if years_since_LLF != . 
		replace years_since_LLFpost0 	= 1 if years_since_LLF == 0 	

	forval i = 1/9 {
		gen 	years_since_LLFpost`i' 	= 0 if years_since_LLF != . 
		replace years_since_LLFpost`i' 	= 1 if years_since_LLF == `i'
 	}
		
		forval j = 1/9 { 
			gen noson_pre_`j' = years_since_LLFpre`j' *noson
			} 
		forval j = 0/9 { 
			gen noson_p_post_`j' = years_since_LLFpost`j'*noson 
			}
		
	* make interactions parity x years since LLF leaving out parity 0 moms
	forval i = 1/3 { 
		
		forval j = 1/9 { 
			gen p`i'_LLFpre`j' = 0 if years_since_LLF != . & parity != . 
			replace p`i'_LLFpre`j' = 1 if years_since_LLF == -`j' & parity == `i' 
			} 
			
			gen p`i'_LLFpost0 = 0 if years_since_LLF != . & parity != . 
			replace p`i'_LLFpost0 = 1 if years_since_LLF == 0 & parity == `i' 
			
		forval j = 1/9 { 
			gen p`i'_LLFpost`j' = 0 if years_since_LLF != . & parity != . 
			replace p`i'_LLFpost`j' = 1 if years_since_LLF == `j' & parity == `i' 
			} 
		}	
		
	* make interactions parity x years since LLF x sons leaving out parity 0 moms
	forval i = 1/3 { 
		
		forval j = 1/9 { 
			gen p`i'_LLFpre`j'_son =  p`i'_LLFpre`j'*hasson 
			} 
			
			gen p`i'_LLFpost0_son = p`i'_LLFpost0*hasson 
			
		forval j = 1/9 { 
			gen p`i'_LLFpost`j'_son =  p`i'_LLFpost`j'*hasson
			} 
		}
	
	forval j = 1/9 { 
		gen pre_`j'_son = years_since_LLFpre`j' *hasson
		} 
	forval j = 0/9 { 
		gen post_`j'_son = years_since_LLFpost`j'*hasson 
		}
			
	global controls1 	"m_year_birth i.educ age_marriage U5MR_5yr_ave"
	global controls2 	"grain agric_production gdp pop_total_agric"
	
	order m_year_birth-year  years_since_LLFpre9 years_since_LLFpre8 years_since_LLFpre7 years_since_LLFpre6 ///
		years_since_LLFpre5 years_since_LLFpre4 years_since_LLFpre3 years_since_LLFpre2 years_since_LLFpre1 ///
		years_since_LLFpost0 years_since_LLFpost1 years_since_LLFpost2 years_since_LLFpost3 years_since_LLFpost4 years_since_LLFpost5 ///
		years_since_LLFpost6 years_since_LLFpost7 years_since_LLFpost8 years_since_LLFpost9  ///
		pre_9_son pre_8_son pre_7_son pre_6_son pre_5_son pre_4_son pre_3_son pre_2_son ///
		post_0_son post_1_son post_2_son post_3_son post_4_son post_5_son post_6_son post_7_son post_8_son post_9_son ///
		p1_LLFpre9 p1_LLFpre8 p1_LLFpre7 p1_LLFpre6 p1_LLFpre5 p1_LLFpre4 p1_LLFpre3 p1_LLFpre2 p1_LLFpre1 ///
		p1_LLFpost0 p1_LLFpost1 p1_LLFpost2 p1_LLFpost3 p1_LLFpost4 p1_LLFpost5 p1_LLFpost6 p1_LLFpost7 p1_LLFpost8 p1_LLFpost9 ///
		p2_LLFpre9 p2_LLFpre8 p2_LLFpre7 p2_LLFpre6 p2_LLFpre5 p2_LLFpre4 p2_LLFpre3 p2_LLFpre2 p2_LLFpre1 ///
		p2_LLFpost0 p2_LLFpost1 p2_LLFpost2 p2_LLFpost3 p2_LLFpost4 p2_LLFpost5 p2_LLFpost6 p2_LLFpost7 p2_LLFpost8 p2_LLFpost9 ///
		p3_LLFpre9 p3_LLFpre8 p3_LLFpre7 p3_LLFpre6 p3_LLFpre5 p3_LLFpre4 p3_LLFpre3 p3_LLFpre2 p3_LLFpre1 ///
		p3_LLFpost0 p3_LLFpost1 p3_LLFpost2 p3_LLFpost3 p3_LLFpost4 p3_LLFpost5 p3_LLFpost6 p3_LLFpost7 p3_LLFpost8 p3_LLFpost9 ///
		p1_LLFpre9_son p1_LLFpre8_son p1_LLFpre7_son p1_LLFpre6_son p1_LLFpre5_son p1_LLFpre4_son p1_LLFpre3_son p1_LLFpre2_son p1_LLFpre1_son ///
		p1_LLFpost0_son p1_LLFpost1_son p1_LLFpost2_son p1_LLFpost3_son p1_LLFpost4_son p1_LLFpost5_son p1_LLFpost6_son p1_LLFpost7_son p1_LLFpost8_son p1_LLFpost9_son ///
		p2_LLFpre9_son p2_LLFpre8_son p2_LLFpre7_son p2_LLFpre6_son p2_LLFpre5_son p2_LLFpre4_son p2_LLFpre3_son p2_LLFpre2_son p2_LLFpre1_son ///
		p2_LLFpost0_son p2_LLFpost1_son p2_LLFpost2_son p2_LLFpost3_son p2_LLFpost4_son p2_LLFpost5_son p2_LLFpost6_son p2_LLFpost7_son p2_LLFpost8_son p2_LLFpost9_son ///
		p3_LLFpre9_son p3_LLFpre8_son p3_LLFpre7_son p3_LLFpre6_son p3_LLFpre5_son p3_LLFpre4_son p3_LLFpre3_son p3_LLFpre2_son p3_LLFpre1_son ///
		p3_LLFpost0_son p3_LLFpost1_son p3_LLFpost2_son p3_LLFpost3_son p3_LLFpost4_son p3_LLFpost5_son p3_LLFpost6_son p3_LLFpost7_son p3_LLFpost8_son p3_LLFpost9_son 

	gen p1_son = p_1*hasson
	gen p2_son = p_2*hasson
	gen p3_son = p_3*hasson
		
	drop if years_since_LLF>7
	char FE_prov[omit] 108 
	drop if years_since_LLF<-8

*****************************************************
* (3.0) PPR Regression
*****************************************************
	xi: reg delivered years_since_LLFpre8-years_since_LLFpre2 years_since_LLFpost0-years_since_LLFpost7 ///
				pre_8_son-pre_2_son post_0_son-post_7_son ///
				p1_LLFpre8-p1_LLFpre2 p1_LLFpost0-p1_LLFpost7  ///
				p2_LLFpre8-p2_LLFpre2 p2_LLFpost0-p2_LLFpost7 ///
				p2_LLFpre8_son-p2_LLFpre2_son p2_LLFpost0_son-p2_LLFpost7_son ///
				p3_LLFpre8-p3_LLFpre2 p3_LLFpost0-p3_LLFpost7 ///
				p3_LLFpre8_son-p3_LLFpre2_son p3_LLFpost0_son-p3_LLFpost7_son ///
				p_1 p_2 p_3 hasson  p2_son p3_son culturalrev $controls1 $controls2 i.FE_t i.FE_prov ///
				if year!=1967 & year !=1968 & years_since_LLF<8, cluster(prov)
			
	*****************************************************
	* (3.1) Evaluate linear predictions, and bootstrap the CIs
	*****************************************************
	mat coef = e(b)
	mat var = e(V)
		
		mat results = J(1,6, .) 
		
		local j = 1
		
		forval i = 2/8 {	
			local k = abs(`i' - 10)

			boottest (p`j'_LLFpre`k' = 0), bootcluster(prov) weighttype(rademacher) ///
			boottype(wild) reps(999) nograph gridpoints(100) seed(1234)
						
			local dof = r(df_r)
			local tstat = r(t) 
			local pval = r(p) 
			mat ci = r(CI)
			
			lincom p`j'_LLFpre`k' + 0
			local est = r(estimate)
			
			mat temp1 = `i', `j', 0, `est', ci[1,1], ci[1,2]

			boottest (p`j'_LLFpre`k' + pre_`k'_son = 0), bootcluster(prov) weighttype(rademacher) ///
			boottype(wild) reps(999) nograph gridpoints(100) seed(1234)
						
			local dof = r(df_r)
			local tstat = r(t) 
			local pval = r(p) 
			mat ci = r(CI)
		
			lincom p`j'_LLFpre`k' + pre_`k'_son 
			local est = r(estimate)
				
			mat temp2 = `i', `j', 1, `est', ci[1,1], ci[1,2]
			mat results = results \ temp1 \ temp2
			}
			
		forval i = 9/16 {
			local k = abs(`i' - 9)
			boottest (p`j'_LLFpost`k' = 0), bootcluster(prov) weighttype(rademacher) ///
			boottype(wild) reps(999) nograph gridpoints(100) seed(1234)
						
			local dof = r(df_r)
			local tstat = r(t) 
			local pval = r(p) 
			mat ci = r(CI)
		
			lincom p`j'_LLFpost`k' + 0
			local est = r(estimate)
				
			mat temp1 = `i', `j', 0, `est', ci[1,1], ci[1,2]

			boottest (p`j'_LLFpost`k' + post_`k'_son = 0), bootcluster(prov) weighttype(rademacher) ///
			boottype(wild) reps(999) nograph gridpoints(100) seed(1234)
						
			local dof = r(df_r)
			local tstat = r(t) 
			local pval = r(p) 
			mat ci = r(CI)
		
			lincom p`j'_LLFpost`k' + post_`k'_son 
			local est = r(estimate)
				
			mat temp2 = `i', `j', 1, `est', ci[1,1], ci[1,2]
			mat results = results \ temp1 \ temp2
			}
		
		
		forval j = 2/3 {
		
		forval i = 2/8 {	
			local k = abs(`i' - 10)

			boottest (p`j'_LLFpre`k' = 0), bootcluster(prov) weighttype(rademacher) ///
			boottype(wild) reps(999) nograph gridpoints(100) seed(1234)
						
			local dof = r(df_r)
			local tstat = r(t) 
			local pval = r(p) 
			mat ci = r(CI)
		
			lincom p`j'_LLFpre`k' + 0
			local est = r(estimate)
				
			mat temp1 = `i', `j', 0, `est', ci[1,1], ci[1,2]

			boottest (p`j'_LLFpre`k' + pre_`k'_son + p`j'_LLFpre`k'_son = 0), bootcluster(prov) weighttype(rademacher) ///
			boottype(wild) reps(999) nograph gridpoints(100) seed(1234)
						
			local dof = r(df_r)
			local tstat = r(t) 
			local pval = r(p) 
			mat ci = r(CI)
		
			lincom p`j'_LLFpre`k' + pre_`k'_son + p`j'_LLFpre`k'_son 
			local est = r(estimate)
				
			mat temp2 = `i', `j', 1, `est', ci[1,1], ci[1,2]
			mat results = results \ temp1 \ temp2
			}
			
		forval i = 9/16 {
			local k = abs(`i' - 9)

			boottest (p`j'_LLFpost`k' = 0), bootcluster(prov) weighttype(rademacher) ///
			boottype(wild) reps(999) nograph gridpoints(100) seed(1234)
						
			local dof = r(df_r)
			local tstat = r(t) 
			local pval = r(p) 
			mat ci = r(CI)
		
			lincom p`j'_LLFpost`k' + 0
			local est = r(estimate)
				
			mat temp1 = `i', `j', 0, `est', ci[1,1], ci[1,2]

			boottest (p`j'_LLFpost`k' + post_`k'_son + p`j'_LLFpost`k'_son = 0), bootcluster(prov) weighttype(rademacher) ///
			boottype(wild) reps(999) nograph gridpoints(100) seed(1234)
						
			local dof = r(df_r)
			local tstat = r(t) 
			local pval = r(p) 
			mat ci = r(CI)
		
			lincom p`j'_LLFpost`k' + post_`k'_son + p`j'_LLFpost`k'_son 
			local est = r(estimate)
				
			mat temp2 = `i', `j', 1, `est', ci[1,1], ci[1,2]
			mat results = results \ temp1 \ temp2			
			
			}
		} 
					
		forval i = 2/8 {	
			local k = abs(`i' - 10)

			boottest (years_since_LLFpre`k' = 0), bootcluster(prov) weighttype(rademacher) ///
			boottype(wild) reps(999) nograph gridpoints(100) seed(1234)
						
			local dof = r(df_r)
			local tstat = r(t) 
			local pval = r(p) 
			mat ci = r(CI)
		
			lincom years_since_LLFpre`k' + 0
			local est = r(estimate)
					
			mat temp = `i', 0, ., `est', ci[1,1], ci[1,2]
			mat results = results \ temp
			
			}
			
		forval i = 9/16 {
			local k = abs(`i' - 9)

			boottest (years_since_LLFpost`k' = 0), bootcluster(prov) weighttype(rademacher) ///
			boottype(wild) reps(999) nograph gridpoints(100) seed(1234)
						
			local dof = r(df_r)
			local tstat = r(t) 
			local pval = r(p) 
			mat ci = r(CI)
		
			lincom years_since_LLFpost`k' + 0
			local est = r(estimate)
				
			mat temp = `i', 0, ., `est', ci[1,1], ci[1,2]			
			mat results = results \ temp
			}
							
	************************************************
	* (3.2) Plot Results
	************************************************

	preserve 
	clear 
	svmat results
			rename results1 year
			rename results2 parity
			rename results3 son
			rename results4 coef
			rename results5 cil
			rename results6 ciu
			
		replace year = year - 9 
		replace year = year - 1 if year <= -1
		
		drop if year < -8 
		drop if year > 8 

	gen yline = 0 
	replace parity = parity + 1
	
		*****************************
		* (3.2.1) First Order Births
		*****************************
	twoway 	///
				(rcap cil ciu year if parity == 1 & year>=-1,  lcolor(black))   ///
				(scatter coef year if parity == 1 & year>=-1, msymbol(diamond) mcolor(black) lcolor(black) cmissing(n)) ///
				(rcap cil ciu year if parity == 1 & year<=-1,  lcolor(black))   ///
				(scatter coef year if parity == 1 & year<=-1, msymbol(diamond) mcolor(black) lcolor(black) cmissing(n)) ///
				(line yline year if parity == 1 & year>=-8, lcolor(black) cmissing(n) lpattern(solid)) ///
				if year<8,  ytitle("Percentage Point Change" ) ///
				xtitle("Years Since LLF Policy") yline(0, lcolor(black)) xline(-.5, lcolor(black)) xlab(-8(1)7)  ylab(-.25(.05).15, format(%9.2f)) ///
				legend(order(1 "") pos(6) ) title("First Births")
		
		gr_edit legend.plotregion1.key.draw_view.setstyle, style(no) 
		gr_edit legend.plotregion1.key.fill_if_undrawn.setstyle, style(yes) 
		
		graph export `"$d_fig\Fig_2a_PPR.jpg"', replace		

		*****************************
		* (3.2.2) Second Order Births
		*****************************
		replace year = year + .15 	if son == 1
		replace year = year - .15 	if son == 0

		twoway 	///
					(rcap cil ciu year if parity == 2 & year>=-1 & son==1, lcolor(gs8))   ///
					(scatter coef year if parity == 2 & year>=-1 & son==1, msymbol(dot) mcolor(gs8) lcolor(gs8) cmissing(n)) ///
					(rcap cil ciu year if parity == 2 & year<=-1 & son==1, lcolor(gs8))   ///
					(scatter coef year if parity == 2 & year<=-1 & son==1, msymbol(dot) mcolor(gs8) lcolor(gs8) cmissing(n)) ///
					(rcap cil ciu year if parity == 2 & year>=-1 & son==0, lcolor(black))   ///
					(scatter coef year if parity == 2 & year>=-1 & son==0, msymbol(diamond) msize(medsmall) mcolor(black) lcolor(black) lpattern(dash) cmissing(n)) ///
					(rcap cil ciu year if parity == 2 & year<=-1 & son==0, lcolor(black))   ///
					(scatter coef year if parity == 2 & year<=-1 & son==0, msymbol(diamond) msize(medsmall) mcolor(black) lcolor(black) lpattern(dash) cmissing(n)) ///
					(line yline year if parity == 2 & year>=-8 & son==., lcolor(black) cmissing(n) lpattern(solid)) ///
					if year<7.5 ,  ytitle("Percentage Point Change" ) ///
					xtitle("Years Since LLF Policy") yline(0, lcolor(black)) xline(-.5, lcolor(black)) xlab(-8(1)7)  ylab(-.25(.05).15, format(%9.2f)) ///
					legend(order(1 "Couples with Sons" 5 "Couples with No Previous Sons") rows(1) pos(6)) title("Second Order Births")

					gr_edit legend.plotregion1.AddMarker added_markers editor 3.79182823319298 1.694860199295874
					gr_edit legend.plotregion1.added_markers_new = 1
					gr_edit legend.plotregion1.added_markers_rec = 1
					gr_edit legend.plotregion1.added_markers[1].style.editstyle  marker( symbol(circle) linestyle( width(thin) color(gs8) pattern(solid)) fillcolor(gs8) size(medium) angle(stdarrow) backsymbol(none) backline( width(thin) color(black) pattern(solid)) backcolor(black) backsize(zero) backangle(stdarrow)) line( width(thin) color(black) pattern(solid)) area( linestyle( width(thin) color(white) pattern(solid)) shadestyle( color(white) intensity(inten100) fill(pattern10))) label( textstyle( horizontal(center) vertical(middle) angle(default) size(small) color(black) position() margin(zero) linestyle( width(thin) color(black) pattern(solid))) position(6) textgap(half_tiny) horizontal(default) vertical(default)) dots( symbol(circle) linestyle( width(thin) color(black) pattern(solid)) fillcolor(black) size(vtiny) angle(horizontal) backsymbol(none) backline( width(thin) color(black) pattern(solid)) backcolor(black) backsize(medium) backangle(horizontal)) connect(direct) connect_missings(yes) editcopy

					gr_edit legend.plotregion1.AddMarker added_markers editor 45.72230795834224 1.694860199295874
					gr_edit legend.plotregion1.added_markers_new = 2
					gr_edit legend.plotregion1.added_markers_rec = 2
					gr_edit legend.plotregion1.added_markers[2].style.editstyle  marker( symbol(diamond) linestyle( width(thin) color(black) pattern(solid)) fillcolor(black) size(medium) angle(stdarrow) backsymbol(none) backline( width(thin) color(black) pattern(solid)) backcolor(black) backsize(zero) backangle(stdarrow)) line( width(thin) color(black) pattern(solid)) area( linestyle( width(thin) color(white) pattern(solid)) shadestyle( color(white) intensity(inten100) fill(pattern10))) label( textstyle( horizontal(center) vertical(middle) angle(default) size(small) color(black) position() margin(zero) linestyle( width(thin) color(black) pattern(solid))) position(6) textgap(half_tiny) horizontal(default) vertical(default)) dots( symbol(circle) linestyle( width(thin) color(black) pattern(solid)) fillcolor(black) size(vtiny) angle(horizontal) backsymbol(none) backline( width(thin) color(black) pattern(solid)) backcolor(black) backsize(medium) backangle(horizontal)) connect(direct) connect_missings(yes) editcopy
					
		graph export `"$d_fig\Fig_2b_PPR.jpg"', replace

		*****************************
		* (3.2.3) Third Order Births
		*****************************
		twoway 	///
				(rcap cil ciu year if parity == 3 & year>=-1 & son==1, lcolor(gs8))   ///
				(scatter coef year if parity == 3 & year>=-1 & son==1, msymbol(dot) mcolor(gs8) lcolor(gs8) cmissing(n)) ///
				(rcap cil ciu year if parity == 3 & year<=-1 & son==1, lcolor(gs8))   ///
				(scatter coef year if parity == 3 & year<=-1 & son==1, msymbol(dot) mcolor(gs8) lcolor(gs8) cmissing(n)) ///
				(rcap cil ciu year if parity == 3 & year>=-1 & son==0, lcolor(black))   ///
				(scatter coef year if parity == 3 & year>=-1 & son==0, msymbol(diamond) msize(medsmall) mcolor(black) lcolor(black) cmissing(n)) ///
				(rcap cil ciu year if parity == 3 & year<=-1 & son==0, lcolor(black))   ///
				(scatter coef year if parity == 3 & year<=-1 & son==0, msymbol(diamond) msize(medsmall) mcolor(black) lcolor(black) cmissing(n)) ///
				(line yline year if parity == 3 & year>=-8 & son==., lcolor(black) cmissing(n) lpattern(solid)) ///
				if year<7.5,  ytitle("Percentage Point Change" ) ///
				xtitle("Years Since LLF Policy") yline(0, lcolor(black)) xline(-.5, lcolor(black)) xlab(-8(1)7)  ylab(-.25(.05).15, format(%9.2f)) ///
				legend(order(1 "Couples with Sons" 5 "Couples with No Previous Sons") rows(1) pos(6)) title("Third Order Births")

				gr_edit legend.plotregion1.AddMarker added_markers editor 3.79182823319298 1.694860199295874
				gr_edit legend.plotregion1.added_markers_new = 1
				gr_edit legend.plotregion1.added_markers_rec = 1
				gr_edit legend.plotregion1.added_markers[1].style.editstyle  marker( symbol(circle) linestyle( width(thin) color(gs8) pattern(solid)) fillcolor(gs8) size(medium) angle(stdarrow) backsymbol(none) backline( width(thin) color(black) pattern(solid)) backcolor(black) backsize(zero) backangle(stdarrow)) line( width(thin) color(black) pattern(solid)) area( linestyle( width(thin) color(white) pattern(solid)) shadestyle( color(white) intensity(inten100) fill(pattern10))) label( textstyle( horizontal(center) vertical(middle) angle(default) size(small) color(black) position() margin(zero) linestyle( width(thin) color(black) pattern(solid))) position(6) textgap(half_tiny) horizontal(default) vertical(default)) dots( symbol(circle) linestyle( width(thin) color(black) pattern(solid)) fillcolor(black) size(vtiny) angle(horizontal) backsymbol(none) backline( width(thin) color(black) pattern(solid)) backcolor(black) backsize(medium) backangle(horizontal)) connect(direct) connect_missings(yes) editcopy

				gr_edit legend.plotregion1.AddMarker added_markers editor 45.72230795834224 1.694860199295874
				gr_edit legend.plotregion1.added_markers_new = 2
				gr_edit legend.plotregion1.added_markers_rec = 2
				gr_edit legend.plotregion1.added_markers[2].style.editstyle  marker( symbol(diamond) linestyle( width(thin) color(black) pattern(solid)) fillcolor(black) size(medium) angle(stdarrow) backsymbol(none) backline( width(thin) color(black) pattern(solid)) backcolor(black) backsize(zero) backangle(stdarrow)) line( width(thin) color(black) pattern(solid)) area( linestyle( width(thin) color(white) pattern(solid)) shadestyle( color(white) intensity(inten100) fill(pattern10))) label( textstyle( horizontal(center) vertical(middle) angle(default) size(small) color(black) position() margin(zero) linestyle( width(thin) color(black) pattern(solid))) position(6) textgap(half_tiny) horizontal(default) vertical(default)) dots( symbol(circle) linestyle( width(thin) color(black) pattern(solid)) fillcolor(black) size(vtiny) angle(horizontal) backsymbol(none) backline( width(thin) color(black) pattern(solid)) backcolor(black) backsize(medium) backangle(horizontal)) connect(direct) connect_missings(yes) editcopy
			
		graph export `"$d_fig\Fig_2c_PPR.jpg"', replace
		
		*****************************
		* (3.2.4) Fourth Order Births
		*****************************
		twoway 	///
				(rcap cil ciu year if parity == 4 & year>=-1 & son==1, lcolor(gs8))   ///
				(scatter coef year if parity == 4 & year>=-1 & son==1, msymbol(dot) mcolor(gs8) lcolor(gs8) cmissing(n)) ///
				(rcap cil ciu year if parity == 4 & year<=-1 & son==1, lcolor(gs8))   ///
				(scatter coef year if parity == 4 & year<=-1 & son==1, msymbol(dot) mcolor(gs8) lcolor(gs8) cmissing(n)) ///
				(rcap cil ciu year if parity == 4 & year>=-1 & son==0, lcolor(black))   ///
				(scatter coef year if parity == 4 & year>=-1 & son==0, msymbol(diamond) msize(medsmall) mcolor(black) lcolor(black) cmissing(n)) ///
				(rcap cil ciu year if parity == 4 & year<=-1 & son==0, lcolor(black))   ///
				(scatter coef year if parity == 4 & year<=-1 & son==0, msymbol(diamond) msize(medsmall) mcolor(black) lcolor(black) cmissing(n)) ///
				(line yline year if parity == 4 & year>=-8 & son==., lcolor(black) cmissing(n) lpattern(solid)) ///
				if year<7.5 ,  ytitle("Percentage Point Change" ) ///
				xtitle("Years Since LLF Policy") yline(0, lcolor(black)) xline(-.5, lcolor(black)) xlab(-8(1)7)  ylab(-.25(.05).15, format(%9.2f)) ///
				legend(order(1 "Couples with Sons" 5 "Couples with No Previous Sons") rows(1) pos(6)) title("Fourth and Higher Order Births")

				gr_edit legend.plotregion1.AddMarker added_markers editor 3.79182823319298 1.694860199295874
				gr_edit legend.plotregion1.added_markers_new = 1
				gr_edit legend.plotregion1.added_markers_rec = 1
				gr_edit legend.plotregion1.added_markers[1].style.editstyle  marker( symbol(circle) linestyle( width(thin) color(gs8) pattern(solid)) fillcolor(gs8) size(medium) angle(stdarrow) backsymbol(none) backline( width(thin) color(black) pattern(solid)) backcolor(black) backsize(zero) backangle(stdarrow)) line( width(thin) color(black) pattern(solid)) area( linestyle( width(thin) color(white) pattern(solid)) shadestyle( color(white) intensity(inten100) fill(pattern10))) label( textstyle( horizontal(center) vertical(middle) angle(default) size(small) color(black) position() margin(zero) linestyle( width(thin) color(black) pattern(solid))) position(6) textgap(half_tiny) horizontal(default) vertical(default)) dots( symbol(circle) linestyle( width(thin) color(black) pattern(solid)) fillcolor(black) size(vtiny) angle(horizontal) backsymbol(none) backline( width(thin) color(black) pattern(solid)) backcolor(black) backsize(medium) backangle(horizontal)) connect(direct) connect_missings(yes) editcopy

				gr_edit legend.plotregion1.AddMarker added_markers editor 45.72230795834224 1.694860199295874
				gr_edit legend.plotregion1.added_markers_new = 2
				gr_edit legend.plotregion1.added_markers_rec = 2
				gr_edit legend.plotregion1.added_markers[2].style.editstyle  marker( symbol(diamond) linestyle( width(thin) color(black) pattern(solid)) fillcolor(black) size(medium) angle(stdarrow) backsymbol(none) backline( width(thin) color(black) pattern(solid)) backcolor(black) backsize(zero) backangle(stdarrow)) line( width(thin) color(black) pattern(solid)) area( linestyle( width(thin) color(white) pattern(solid)) shadestyle( color(white) intensity(inten100) fill(pattern10))) label( textstyle( horizontal(center) vertical(middle) angle(default) size(small) color(black) position() margin(zero) linestyle( width(thin) color(black) pattern(solid))) position(6) textgap(half_tiny) horizontal(default) vertical(default)) dots( symbol(circle) linestyle( width(thin) color(black) pattern(solid)) fillcolor(black) size(vtiny) angle(horizontal) backsymbol(none) backline( width(thin) color(black) pattern(solid)) backcolor(black) backsize(medium) backangle(horizontal)) connect(direct) connect_missings(yes) editcopy
			
		graph export `"$d_fig\Fig_2d_PPR.jpg"', replace

	restore	

	


